package com.bwie.auth.remote.factory;

import com.bwie.auth.remote.RemoteSysUser;
import com.bwie.common.domain.SysUser;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteSysUserFactory implements FallbackFactory<RemoteSysUser> {
    @Override
    public RemoteSysUser create(Throwable cause) {
        return new RemoteSysUser() {
            @Override
            public Result<SysUser> selectOneByName(String username) {
                return Result.error("根据用户名获取用户信息失败，错误信息为："+cause.getMessage());
            }
        };
    }
}
